home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.3 / ExprLong.3 < prev    next >
Text File  |  1995-07-25  |  8KB  |  133 lines

  1.  
  2.  
  3.  
  4.      TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333))))             TTTTccccllll ((((7777....0000))))             TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBool, Tcl_ExprString -
  12.           evaluate an expression
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  16.  
  17.           int
  18.           TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg(_i_n_t_e_r_p, _s_t_r_i_n_g, _l_o_n_g_P_t_r)
  19.  
  20.           int
  21.           TTTTccccllll____EEEExxxxpppprrrrDDDDoooouuuubbbblllleeee(_i_n_t_e_r_p, _s_t_r_i_n_g, _d_o_u_b_l_e_P_t_r)
  22.  
  23.           int
  24.           TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn(_i_n_t_e_r_p, _s_t_r_i_n_g, _b_o_o_l_e_a_n_P_t_r)
  25.  
  26.           int
  27.           TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg(_i_n_t_e_r_p, _s_t_r_i_n_g)
  28.  
  29.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  30.           Tcl_Interp   *_i_n_t_e_r_p       (in)      Interpreter  in   whose
  31.                                                context   to   evaluate
  32.                                                _s_t_r_i_n_g.
  33.  
  34.           char         *_s_t_r_i_n_g       (in)      Expression    to     be
  35.                                                evaluated.   Must be in
  36.                                                writable  memory   (the
  37.                                                expression parser makes
  38.                                                temporary modifications
  39.                                                to  the  string  during
  40.                                                parsing,    which    it
  41.                                                undoes           before
  42.                                                returning).
  43.  
  44.           long         *_l_o_n_g_P_t_r      (out)     Pointer to location  in
  45.                                                which   to   store  the
  46.                                                integer  value  of  the
  47.                                                expression.
  48.  
  49.           int          *_d_o_u_b_l_e_P_t_r    (out)     Pointer to location  in
  50.                                                which   to   store  the
  51.                                                floating-point value of
  52.                                                the expression.
  53.  
  54.           int          *_b_o_o_l_e_a_n_P_t_r   (out)     Pointer to location  in
  55.                                                which  to store the 0/1
  56.                                                boolean  value  of  the
  57.                                                expression.
  58.      _________________________________________________________________
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/10/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333))))             TTTTccccllll ((((7777....0000))))             TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg((((3333))))
  71.  
  72.  
  73.  
  74.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  75.           These four procedures all evaluate an expression,  returning
  76.           the  result  in one of four different forms.  The expression
  77.           is given by the _s_t_r_i_n_g argument, and it can have any of  the
  78.           forms  accepted  by  the  eeeexxxxpppprrrr command.  The _i_n_t_e_r_p argument
  79.           refers to an interpreter used  to  evaluate  the  expression
  80.           (e.g.  for  variables and nested Tcl commands) and to return
  81.           error  information.   _I_n_t_e_r_p->_r_e_s_u_l_t  is   assumed   to   be
  82.           initialized   in  the  standard  fashion  when  any  of  the
  83.           procedures are invoked.
  84.  
  85.           For all of these procedures the return value is  a  standard
  86.           Tcl  result:   TTTTCCCCLLLL____OOOOKKKK  means  the expression was succesfully
  87.           evaluated, and TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR means that an error occurred  while
  88.           evaluating  the  expression.   If TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR is returned then
  89.           _i_n_t_e_r_p->_r_e_s_u_l_t will hold a message describing the error.  If
  90.           an  error  occurs  while executing a Tcl command embedded in
  91.           the expression then that error will be returned.
  92.  
  93.           If the expression is successfully evaluated, then its  value
  94.           is  returned  in  one  of  four  forms,  depending  on which
  95.           procedure is invoked.  TTTTccccllll____EEEExxxxpppprrrrLLLLoooonnnngggg stores an integer  value
  96.           at   *_l_o_n_g_P_t_r.   If  the  expression's  actual  value  is  a
  97.           floating-point number, then it is truncated to  an  integer.
  98.           If  the  expression's  actual  value is a non-numeric string
  99.           then an error is returned.
  100.  
  101.           TTTTccccllll____EEEExxxxpppprrrrDDDDoooouuuubbbblllleeee stores a floating-point value at  *_d_o_u_b_l_e_P_t_r.
  102.           If  the  expression's  actual  value  is  an  integer, it is
  103.           converted to floating-point.   If  the  expression's  actual
  104.           value is a non-numeric string then an error is returned.
  105.  
  106.           TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn stores a 0/1 integer value  at  *_b_o_o_l_e_a_n_P_t_r.
  107.           If  the expression's actual value is an integer or floating-
  108.           point number, then TTTTccccllll____EEEExxxxpppprrrrBBBBoooooooolllleeeeaaaannnn stores 0  at  *_b_o_o_l_e_a_n_P_t_r
  109.           if  the value was zero and 1 otherwise.  If the expression's  |
  110.           actual value is a non-numeric string then it must be one  of  |
  111.           the  values  accepted  by TTTTccccllll____GGGGeeeettttBBBBoooooooolllleeeeaaaannnn, such as ``yes'' or  |
  112.           ``no'', or else an error occurs.
  113.  
  114.           TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg returns the value  of  the  expression  as  a
  115.           string stored in _i_n_t_e_r_p->_r_e_s_u_l_t.  If the expression's actual  |
  116.           value is an integer then TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg  converts  it  to  a  |
  117.           string  using  sssspppprrrriiiinnnnttttffff  with  a  ``%d''  converter.   If the  |
  118.           expression's actual value is a floating-point  number,  then  |
  119.           TTTTccccllll____EEEExxxxpppprrrrSSSSttttrrrriiiinnnngggg  calls  TTTTccccllll____PPPPrrrriiiinnnnttttDDDDoooouuuubbbblllleeee  to  convert  it to a  |
  120.           string.
  121.  
  122.  
  123.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  124.           boolean, double, evaluate, expression, integer, string
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 7/10/95)
  130.  
  131.  
  132.  
  133.